#ifndef MD5WRAPPER_H
#define MD5WRAPPER_H

#include <Bust/Crypting/Hash.hpp>

namespace bust {

class MD5 : public Hash {
	private:
		typedef unsigned char *POINTER;
		struct MD5data {
				unsigned long int state[4];
				unsigned long int count[2];
				unsigned char buffer[64];
		};
		void transform( unsigned long int state[4], unsigned char block[64] );
		void encode( unsigned char*, unsigned long int*, unsigned int );
		void decode( unsigned long int*, unsigned char*, unsigned int );
		void MD5_memcpy( POINTER, POINTER, unsigned int );
		void MD5_memset( POINTER, int, unsigned int );
		void init( MD5data& );
		void update( MD5data&, unsigned char*, unsigned int );
		void final( unsigned char[16], MD5data& );
		std::string convToString( unsigned char *bytes );
	public:
		MD5();
		~MD5();
		std::string getHashFromString( std::string text );
		std::string getHashFromFile( std::string filename );
		const char* engineName();
};

}

#endif
